//package com.cssy.yd.logic.web;
//
//import java.util.List;
//import java.util.Map;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.commons.lang.StringUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.validation.BindingResult;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import com.cssy.authority.service.IScUserRolewhPlaceService;
//import com.cssy.base.web.BaseController;
//import com.cssy.base.web.BodyMsg;
//import com.cssy.yd.dock.service.IXxm2eMaterialIssueService;
//import com.cssy.yd.logic.entity.LogicProGetApplyDO;
//import com.cssy.yd.logic.entity.LogicProGetApplyItemDO;
//import com.cssy.yd.logic.entity.LogicProGetDO;
//import com.cssy.yd.logic.entity.LogicSkReturnDO;
//import com.cssy.yd.logic.entity.LogicSkReturnItemDO;
//import com.cssy.yd.logic.service.ILogicProGetApplyItemService;
//import com.cssy.yd.logic.service.ILogicProGetApplyService;
//import com.cssy.yd.logic.util.SqlUtil;
//import com.plat.exception.SyBaseException;
//import com.plat.helper.JqGridHandler;
//import com.plat.helper.SearchCondition;
//import com.plat.helper.SearchConditions;
//import com.plat.helper.SearchResult;
//import com.plat.util.GlobalResLoader;
//import com.plat.util.OperationFlag;
//import com.plat.util.json.OutJsonGrid;
//
//@Controller
//@RequestMapping("/yd/logic/progetapply2")
//public class LogicProGetApply2Controller extends
//		BaseController<LogicProGetApplyDO> {
//
//	private static final String MANAGER = "/yd/logic/proget/ApplyManager2";
//	private static final String EIDT = "/yd/logic/proget/ApplyOperation2";// 添加、修改、显示页面
//	
//	@Resource(name="scUserRolePlaceService")
//	private IScUserRolewhPlaceService scUserRolePlaceService;
//	
//	@Resource(name = "logicProGetApplyService")
//	private ILogicProGetApplyService logicProGetApplyService;
//
//	@Resource(name = "logicProGetApplyItemService")
//	private ILogicProGetApplyItemService logicProGetApplyItemService;
//	
//	@Resource(name="xxm2eMaterialIssueService")
//	private IXxm2eMaterialIssueService ixxmater;
//	
//	@Override
//	public String manager(HttpServletRequest request, Model model)
//			throws Exception {
//		ixxmater.sync();
//		return MANAGER;
//	}
//
//	@Override
//	public void list(HttpServletRequest request, HttpServletResponse response)
//			throws Exception {
//		JqGridHandler hander = new JqGridHandler(request);
//		SearchConditions scs = new SearchConditions();
//		hander.getWheres(scs);
//		 if(scs.getOrderBy()==null||"".equals(scs.getOrderBy()))
//			 scs.setOrderBy("dctime desc");
//		scs.addCondition("state","1",SearchCondition.OP_EQUAL);//工单
//		SearchResult result = logicProGetApplyService.findListByExample(scs);
//		OutJsonGrid out = new OutJsonGrid(result);
//		out.printJSon(response);
//	}
//
//	@SuppressWarnings("unchecked")
//	@Override
//	public String operationForm(HttpServletRequest request,
//			@PathVariable String id, @PathVariable String flag, Model model)
//			throws Exception {
//		model.addAttribute("wh",SqlUtil.sqlUtil.roleWH(request, scUserRolePlaceService));
//		if (OperationFlag.ADD.equals(flag)) {// 我新增加时操作
//			model.addAttribute("viewflag", "add");
//			model.addAttribute("xx", 1);// 标示能不能修改内容
//		} else {
//			LogicProGetApplyDO oi = logicProGetApplyService.findListById(id);
//			/*SearchConditions scs = new SearchConditions();
//			scs.addCondition("get_pro_id",oi.getId(),SearchCondition.OP_EQUAL);
//			scs.setRemovedProperty(null);
//			scs.setOrderBy("code");
//			List<LogicProGetApplyItemDO> loiilist = logicProGetApplyItemService.findListByExample(scs).getResults();*/
//			if (oi.getBillStatus() == 0) {
//				model.addAttribute("xx", 1);// 标示能不能修改内容
//				model.addAttribute("viewflag", "tijiao");
//			} else {
//				model.addAttribute("xx", 2);// 标示能不能修改内容
//			}
//			if (oi.getBillStatus() == 2) {
//				model.addAttribute("viewflag", "tongguo");
//			}
//			if (oi.getBillStatus() == 1) {
//				model.addAttribute("viewflag", "shenpi");
//			}
//			model.addAttribute("oi", oi);
//			//model.addAttribute("axxJson", loiilist);
//		}
//		return EIDT;
//	}
//	
//	@RequestMapping("/griditems")
//	public void griditems(HttpServletRequest request,HttpServletResponse response) throws Exception{
//		String id = request.getParameter("id");
//		if(StringUtils.isNotBlank(id)){
//			LogicProGetApplyDO oi = logicProGetApplyService.findListById(id);
//			SearchConditions scs = new SearchConditions();
//			scs.addCondition("get_pro_id",oi.getId(),SearchCondition.OP_EQUAL);
//			scs.setRemovedProperty(null);
//			scs.setOrderBy("code");
//			List<LogicProGetApplyItemDO> loiilist = logicProGetApplyItemService.findListByExample(scs).getResults();
//			OutJsonGrid out = new OutJsonGrid(loiilist);
//			out.printJSon(response);
//		}
//	}
//
//	@Override
//	public Map<String, Object> save(HttpServletRequest request,
//			LogicProGetApplyDO curAP, BindingResult result, Model model)
//			throws Exception {BodyMsg bodyMap = BodyMsg.getInstance();
//			try {
//				logicProGetApplyService.proGetSave(request,curAP);
//				bodyMap.isSuccess();
//				bodyMap.configWebInfor(GlobalResLoader.getOpsuccess());
//			} catch (SyBaseException e) {
//				e.printStackTrace();
//				bodyMap.isFail();
//				bodyMap.configWebInfor(GlobalResLoader.getOpfailed()
//						+ e.getMessage());
//			}
//			return bodyMap.modelMap;
//	}
//
//	@Override
//	public Map<String, Object> delete(HttpServletRequest request,
//			HttpServletResponse response, Model model) throws Exception {
//		return null;
//	}
//	
//	
//}
